<template>
  <div class="home">
    <img alt="Vue logo" src="../assets/logo.png">
    <HelloWorld msg="Welcome to Your Vue.js App"/>

    <br />

    <p>输出的token: {{ token }}</p>
  </div>
</template>

<script>
// @ is an alias to /src
import HelloWorld from '@/components/HelloWorld.vue'
import actions from "@/shared/actions";

export default {
  name: 'Home',
  components: {
    HelloWorld
  },
  data() {
    return {
      token: ''
    }
  },
  mounted() {
    actions.onGlobalStateChange(state => {
      console.log("显示页面 state 值：", state);
      const { token } = state;
      this.token = token;
    }, true);
  }
}
</script>
